using System;
using System.ComponentModel;
using System.Drawing;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ICP_MS.Plugin.Tune;

public class FormMajor : Form
{
	private bool isQuit = false;

	private ToolTip ttpSettings = new ToolTip();

	private double dev = 0.0;

	private IContainer components = null;

	private TurnCntlFeed tcfFocus;

	private TurnCntlFeed tcfD1;

	private TurnCntlFeed tcfPoleBias;

	private TurnCntlFeed tcfExtraction;

	private TurnCntlFeed tcfLens1;

	private TurnCntlFeed tcfNebuliser;

	private TurnCntlFeed tcfZ;

	private TurnCntlFeed tcfPower;

	private FlowLayoutPanel flowLayoutPanel1;

	private TurnCntlFeed tcfLens2;

	private TurnCntlFeed tcfLens3;

	private TurnCntlFeed tcfX;

	private TurnCntlFeed tcfY;

	private TurnCntlFeed tcfD2;

	private TurnCntl tcfQuadPole;

	private TurnCntl tcfprePole;

	private CheckBox chkLink;

	public FormMajor()
	{
		InitializeComponent();
		ttpSettings.InitialDelay = 200;
		ttpSettings.AutoPopDelay = 10000;
		ttpSettings.ReshowDelay = 200;
		ttpSettings.ShowAlways = true;
		ttpSettings.IsBalloon = true;
	}

	private void InitConfigs()
	{
		try
		{
			double quadVacuum = Vacuum.vacumm.ReadVacuum[2];
			int status1 = Vacuum.vacumm.ReadVacuumStatus[2];
			tcfQuadPole.Value = Convert.ToDecimal(RFManager.rfs.quadPole);
			tcfprePole.Value = Convert.ToDecimal(RFManager.rfs.prePole);
			tcfD2.Value = Convert.ToDecimal(LensManager.x2lens.D2);
			tcfLens3.Value = Convert.ToDecimal(LensManager.x2lens.L3);
			tcfLens2.Value = Convert.ToDecimal(LensManager.x2lens.L2);
			tcfX.Value = Convert.ToDecimal(PlatManager.plat.X);
			tcfY.Value = Convert.ToDecimal(PlatManager.plat.Z);
			tcfZ.Value = Convert.ToDecimal(PlatManager.plat.Y);
			tcfExtraction.Value = Convert.ToDecimal(LensManager.x2lens.Ex);
			tcfLens1.Value = Convert.ToDecimal(LensManager.x2lens.L1);
			tcfD1.Value = Convert.ToDecimal(LensManager.x2lens.D1);
			tcfFocus.Value = Convert.ToDecimal(LensManager.x2lens.F);
			tcfPoleBias.Value = Convert.ToDecimal(LensManager.x2lens.Pole);
			tcfprePole.Value = Convert.ToDecimal(RFManager.rfs.prePole);
			tcfNebuliser.Value = Convert.ToDecimal(PlasmaManager.plasma.Nebuliser);
			tcfPower.Value = Convert.ToDecimal(PlasmaManager.plasma.Power);
		}
		catch
		{
			Log.InsertLog("Major", "Params exceed limit.", "", (Severity)3);
		}
	}

	private void TermConfigs()
	{
		RemoveConfigsMsg();
	}

	private void AddConfigsMsg()
	{
		tcfExtraction.ValueChanged += Major_ValueChanged;
		tcfPoleBias.ValueChanged += Major_ValueChanged;
		tcfD1.ValueChanged += Major_ValueChanged;
		tcfFocus.ValueChanged += Major_ValueChanged;
		tcfLens1.ValueChanged += Major_ValueChanged;
		tcfD2.ValueChanged += Major_ValueChanged;
		tcfLens3.ValueChanged += Major_ValueChanged;
		tcfLens2.ValueChanged += Major_ValueChanged;
		tcfZ.ValueChanged += Major_ValueChanged;
		tcfNebuliser.ValueChanged += Major_ValueChanged;
		tcfPower.ValueChanged += Major_ValueChanged;
		tcfX.ValueChanged += Major_ValueChanged;
		tcfY.ValueChanged += Major_ValueChanged;
		tcfQuadPole.ValueChanged += Major1_ValueChanged;
		tcfprePole.ValueChanged += Major1_ValueChanged;
	}

	private void RemoveConfigsMsg()
	{
		tcfExtraction.ValueChanged -= Major_ValueChanged;
		tcfPoleBias.ValueChanged -= Major_ValueChanged;
		tcfD1.ValueChanged -= Major_ValueChanged;
		tcfFocus.ValueChanged -= Major_ValueChanged;
		tcfLens1.ValueChanged -= Major_ValueChanged;
		tcfD2.ValueChanged -= Major_ValueChanged;
		tcfLens3.ValueChanged -= Major_ValueChanged;
		tcfLens2.ValueChanged -= Major_ValueChanged;
		tcfZ.ValueChanged -= Major_ValueChanged;
		tcfNebuliser.ValueChanged -= Major_ValueChanged;
		tcfPower.ValueChanged -= Major_ValueChanged;
		tcfX.ValueChanged -= Major_ValueChanged;
		tcfY.ValueChanged -= Major_ValueChanged;
		tcfQuadPole.ValueChanged -= Major1_ValueChanged;
		tcfprePole.ValueChanged -= Major1_ValueChanged;
	}

	private void Major1_ValueChanged(object sender, EventArgs e)
	{
		string name = (sender as TurnCntl).Name;
		double value = decimal.ToDouble((sender as TurnCntl).Value);
		double quadVacuum = Vacuum.vacumm.ReadVacuum[2];
		int status1 = Vacuum.vacumm.ReadVacuumStatus[2];
		if (name == tcfQuadPole.Name)
		{
			if (chkLink.Checked)
			{
				RFManager.rfs.quadPole = decimal.ToSingle(tcfQuadPole.Value);
				LensManager.x2lens.Pole = (double)RFManager.rfs.quadPole - dev;
				if ((decimal)LensManager.x2lens.Pole < tcfPoleBias.MinValue || (decimal)LensManager.x2lens.Pole > tcfPoleBias.MaxValue)
				{
					MessageBox.Show("六极杆偏置设置超出范围，联动设置已停止");
					chkLink.Checked = false;
					return;
				}
				Invoke((MethodInvoker)delegate
				{
					tcfPoleBias.ValueChanged -= Major_ValueChanged;
					tcfPoleBias.Value = (decimal)LensManager.x2lens.Pole;
					LensManager.Instance.X2_SetPole();
					tcfPoleBias.ValueChanged += Major_ValueChanged;
					if (Detector.detectorConfig.IsNewDetector)
					{
						Detector.Instance.msDetectorRF.SetQuadPoleNew();
					}
					else
					{
						Detector.Instance.msDetectorRF.SetQuadPole();
					}
				});
			}
			else
			{
				RFManager.rfs.quadPole = decimal.ToSingle(tcfQuadPole.Value);
				if (Detector.detectorConfig.IsNewDetector)
				{
					Detector.Instance.msDetectorRF.SetQuadPoleNew();
				}
				else
				{
					Detector.Instance.msDetectorRF.SetQuadPole();
				}
			}
		}
		else if (name == tcfprePole.Name)
		{
			RFManager.rfs.prePole = decimal.ToSingle(tcfprePole.Value);
			if (Detector.detectorConfig.IsNewDetector)
			{
				Detector.Instance.msDetectorRF.SetPrePoleNew();
			}
			else
			{
				Detector.Instance.msDetectorRF.SetPrePole();
			}
		}
	}

	private void Major_ValueChanged(object sender, EventArgs e)
	{
		string name = (sender as TurnCntlFeed).Name;
		double value = decimal.ToDouble((sender as TurnCntlFeed).Value);
		double quadVacuum = Vacuum.vacumm.ReadVacuum[2];
		int status1 = Vacuum.vacumm.ReadVacuumStatus[2];
		bool bright = Vacuum.Instance.QuadVacuumOK;
		if (name == tcfExtraction.Name)
		{
			if (bright || UserManager.CurrentUser.authority > 1)
			{
				LensManager.x2lens.Ex = value;
				LensManager.Instance.X2_SetEx();
			}
			else
			{
				MessageBox.Show("四极杆真空未达到！不能设置提取透镜电压", Lang.Txt("AddFormIgnite.Warn"));
			}
		}
		else if (name == tcfD1.Name)
		{
			if (bright || UserManager.CurrentUser.authority > 1)
			{
				LensManager.x2lens.D1 = value;
				LensManager.Instance.X2_SetD1();
			}
			else
			{
				MessageBox.Show("四极杆真空未达到！不能设置D1电压", Lang.Txt("AddFormIgnite.Warn"));
			}
		}
		else if (name == tcfPoleBias.Name)
		{
			if (chkLink.Checked)
			{
				LensManager.x2lens.Pole = value;
				if ((decimal)LensManager.x2lens.Pole < tcfPoleBias.MinValue || (decimal)LensManager.x2lens.Pole > tcfPoleBias.MaxValue)
				{
					MessageBox.Show("六极杆偏置设置超出范围，联动设置已停止");
					chkLink.Checked = false;
					return;
				}
				RFManager.rfs.quadPole = (float)(LensManager.x2lens.Pole + dev);
				if ((decimal)RFManager.rfs.quadPole < tcfQuadPole.MinValue || (decimal)RFManager.rfs.quadPole > tcfQuadPole.MaxValue)
				{
					MessageBox.Show("四极杆偏置已超出最大范围，联动设置已停止");
					chkLink.Checked = false;
					return;
				}
				Invoke((MethodInvoker)delegate
				{
					tcfQuadPole.ValueChanged -= Major1_ValueChanged;
					tcfQuadPole.Value = (decimal)RFManager.rfs.quadPole;
					if (Detector.detectorConfig.IsNewDetector)
					{
						Detector.Instance.msDetectorRF.SetQuadPoleNew();
					}
					else
					{
						Detector.Instance.msDetectorRF.SetQuadPole();
					}
					tcfQuadPole.ValueChanged += Major1_ValueChanged;
				});
				LensManager.Instance.X2_SetPole();
			}
			else
			{
				LensManager.x2lens.Pole = value;
				LensManager.Instance.X2_SetPole();
			}
		}
		else if (name == tcfFocus.Name)
		{
			if (bright || UserManager.CurrentUser.authority > 1)
			{
				LensManager.x2lens.F = value;
				LensManager.Instance.X2_SetF();
			}
			else
			{
				MessageBox.Show("四极杆真空未达到！不能设置聚焦透镜电压", Lang.Txt("AddFormIgnite.Warn"));
			}
		}
		else if (name == tcfLens1.Name)
		{
			if (bright || UserManager.CurrentUser.authority > 1)
			{
				LensManager.x2lens.L1 = value;
				LensManager.Instance.X2_SetL1();
			}
			else
			{
				MessageBox.Show("四极杆真空未达到！", Lang.Txt("AddFormIgnite.Warn"));
			}
		}
		else if (name == tcfNebuliser.Name)
		{
			PlasmaManager.plasma.Nebuliser = value;
			Plasma.Instance.OpenNebulizerGas();
		}
		else if (name == tcfZ.Name)
		{
			IgniteConfig igniteconfig = DataBase.Instance.GetIgniteConfig();
			if (Convert.ToDouble(tcfZ.Value) >= igniteconfig.DepthMax)
			{
				tcfZ.Value = Convert.ToDecimal(igniteconfig.DepthMax);
				value = (double)tcfZ.Value;
			}
			PlatManager.plat.Y = (float)value;
			Plasma.Instance.SetYAxis();
		}
		else if (name == tcfPower.Name)
		{
			PlasmaManager.plasma.Power = value;
			Plasma.Instance.SetPower();
		}
		else if (name == tcfD2.Name)
		{
			if (bright || UserManager.CurrentUser.authority > 1)
			{
				LensManager.x2lens.D2 = value;
				LensManager.Instance.X2_SetD2();
			}
			else
			{
				MessageBox.Show("四极杆真空未达到！", Lang.Txt("AddFormIgnite.Warn"));
			}
		}
		else if (name == tcfLens3.Name)
		{
			if (bright || UserManager.CurrentUser.authority > 1)
			{
				LensManager.x2lens.L3 = value;
				LensManager.Instance.X2_SetL3();
			}
			else
			{
				MessageBox.Show("四极杆真空未达到！", Lang.Txt("AddFormIgnite.Warn"));
			}
		}
		else if (name == tcfLens2.Name)
		{
			if (bright || UserManager.CurrentUser.authority > 1)
			{
				LensManager.x2lens.L2 = value;
				LensManager.Instance.X2_SetL2();
			}
			else
			{
				MessageBox.Show("四极杆真空未达到！", Lang.Txt("AddFormIgnite.Warn"));
			}
		}
		else if (name == tcfX.Name)
		{
			PlatManager.plat.X = (float)value;
			Plasma.Instance.SetXAxis();
		}
		else if (name == tcfY.Name)
		{
			PlatManager.plat.Z = (float)value;
			Plasma.Instance.SetZAxis();
		}
	}

	private void FormLens_Load(object sender, EventArgs e)
	{
		IgniteConfig igniteconfig = DataBase.Instance.GetIgniteConfig();
		if (igniteconfig == null)
		{
			igniteconfig = new IgniteConfig();
		}
		tcfX.MaxValue = (decimal)igniteconfig.XMax;
		tcfY.MaxValue = (decimal)igniteconfig.YMax;
		tcfLens2.TipMin = -90.0;
		tcfLens2.TipMax = -70.0;
		tcfLens3.TipMin = -200.0;
		tcfLens3.TipMax = -150.0;
		tcfD2.TipMax = -25.0;
		tcfD2.TipMin = -45.0;
		tcfD1.TipMax = -100.0;
		tcfD1.TipMin = -125.0;
		tcfExtraction.TipMax = -430.0;
		tcfExtraction.TipMin = -650.0;
		tcfFocus.TipMax = 5.0;
		tcfFocus.TipMin = 20.0;
		tcfLens1.TipMax = 0.0;
		tcfLens1.TipMin = -1400.0;
		tcfPoleBias.TipMax = -20.0;
		tcfPoleBias.TipMin = -30.0;
		tcfprePole.TipMin = -2.0;
		tcfprePole.TipMax = 0.0;
		tcfQuadPole.TipMin = -0.5;
		tcfQuadPole.TipMax = -0.5;
		tcfZ.MaxValue = (decimal)igniteconfig.DepthMax;
		InitConfigs();
		AddConfigsMsg();
		Task.Factory.StartNew(delegate
		{
			while (!isQuit)
			{
				try
				{
					Invoke((MethodInvoker)delegate
					{
						tcfExtraction.FeedBack = LensManager.x2lens.ReadEx;
						tcfLens1.FeedBack = LensManager.x2lens.ReadL1;
						tcfFocus.FeedBack = LensManager.x2lens.ReadF;
						tcfD1.FeedBack = LensManager.x2lens.ReadD1;
						tcfPoleBias.FeedBack = LensManager.x2lens.ReadPole;
						tcfExtraction.ImageFeed = LensManager.x2lens.StatusEx;
						tcfLens1.ImageFeed = LensManager.x2lens.StatusL1;
						tcfFocus.ImageFeed = LensManager.x2lens.StatusF;
						tcfD1.ImageFeed = LensManager.x2lens.StatusD1;
						tcfPoleBias.ImageFeed = LensManager.x2lens.StatusPole;
						tcfLens2.FeedBack = LensManager.x2lens.ReadL2;
						tcfLens3.FeedBack = LensManager.x2lens.ReadL3;
						tcfD2.FeedBack = LensManager.x2lens.ReadD2;
						tcfLens2.ImageFeed = LensManager.x2lens.StatusL2;
						tcfLens3.ImageFeed = LensManager.x2lens.StatusL3;
						tcfD2.ImageFeed = LensManager.x2lens.StatusD2;
						tcfX.FeedBack = PlatManager.plat.ReadX / 100.0;
						tcfY.FeedBack = PlatManager.plat.ReadZ / 100.0;
						tcfX.ImageFeed = PlatManager.plat.StatusX;
						tcfY.ImageFeed = PlatManager.plat.StatusZ;
						tcfNebuliser.FeedBack = PlasmaManager.plasma.ReadNebuliser;
						tcfZ.FeedBack = PlatManager.plat.ReadY / 100.0;
						tcfZ.ImageFeed = PlatManager.plat.StatusY;
						tcfPower.FeedBack = PlasmaManager.plasma.ReadForward;
					});
				}
				catch
				{
				}
				Thread.Sleep(1000);
			}
		});
		ApplyResources();
	}

	private void Tcf_MouseEnter(object sender, EventArgs e)
	{
		Control ctrl = (Control)sender;
		string tipOverwrite = " ";
		switch (ctrl.Name)
		{
		case "tcfCollision":
			tipOverwrite = "建议碰撞反应池：1.4~2.0";
			break;
		case "tcfD1":
			tipOverwrite = "建议偏转电压：-125~-100";
			break;
		case "tcfExtraction":
			tipOverwrite = "建议提取透镜：-430~650";
			break;
		case "tcfFocus":
			tipOverwrite = "建议聚焦透镜：-5~20";
			break;
		case "tcfLens1":
			tipOverwrite = "建议透镜1:<-1400";
			break;
		case "tcfPoleBias":
			tipOverwrite = "建议六极杆偏置：-30~-20";
			break;
		}
		ttpSettings.SetToolTip(ctrl, tipOverwrite);
	}

	private void ApplyResources()
	{
		Text = Lang.Txt("FormMajor.Title.Text");
		tcfD1.Label = Lang.Txt("FormMajor.D1.Text");
		tcfExtraction.Label = Lang.Txt("FormMajor.Extraction.Text");
		tcfFocus.Label = Lang.Txt("FormMajor.Focus.Text");
		tcfLens1.Label = Lang.Txt("FormMajor.Lens1.Text");
		tcfNebuliser.Label = Lang.Txt("FormMajor.Nebulizer.Text");
		tcfPoleBias.Label = Lang.Txt("FormMajor.HexPolebias.Text");
		tcfPower.Label = Lang.Txt("FormMajor.Power.Text");
		tcfZ.Label = Lang.Txt("FormMajor.Z.Text");
		tcfD2.Label = Lang.Txt("FormMinor.D2.Text");
		tcfLens2.Label = Lang.Txt("FormMinor.Lens2.Text");
		tcfLens3.Label = Lang.Txt("FormMinor.Lens3.Text");
		tcfX.Label = Lang.Txt("FormMinor.Horizontal.Text");
		tcfY.Label = Lang.Txt("FormMinor.Vertical.Text");
		tcfprePole.Label = Lang.Txt("FormRF.Prebarbias.Text");
		tcfQuadPole.Label = Lang.Txt("FormRF.QuadBias.Text");
		chkLink.Text = Lang.Txt("ADDTune.FormMajor.Text");
	}

	private void FormLens_FormClosing(object sender, FormClosingEventArgs e)
	{
		TermConfigs();
		isQuit = true;
	}

	public void ConfigsChanged(object sender, EventArgs e)
	{
		RemoveConfigsMsg();
		InitConfigs();
		AddConfigsMsg();
	}

	private void chkLink_CheckedChanged(object sender, EventArgs e)
	{
		if (chkLink.Checked)
		{
			dev = (double)RFManager.rfs.quadPole - LensManager.x2lens.Pole;
		}
	}

	protected override void Dispose(bool disposing)
	{
		if (disposing && components != null)
		{
			components.Dispose();
		}
		base.Dispose(disposing);
	}

	private void InitializeComponent()
	{
		this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
		this.tcfX = new ICP_MS.Plugin.Tune.TurnCntlFeed();
		this.tcfY = new ICP_MS.Plugin.Tune.TurnCntlFeed();
		this.tcfZ = new ICP_MS.Plugin.Tune.TurnCntlFeed();
		this.tcfNebuliser = new ICP_MS.Plugin.Tune.TurnCntlFeed();
		this.tcfPower = new ICP_MS.Plugin.Tune.TurnCntlFeed();
		this.tcfExtraction = new ICP_MS.Plugin.Tune.TurnCntlFeed();
		this.tcfLens1 = new ICP_MS.Plugin.Tune.TurnCntlFeed();
		this.tcfLens2 = new ICP_MS.Plugin.Tune.TurnCntlFeed();
		this.tcfPoleBias = new ICP_MS.Plugin.Tune.TurnCntlFeed();
		this.tcfLens3 = new ICP_MS.Plugin.Tune.TurnCntlFeed();
		this.tcfFocus = new ICP_MS.Plugin.Tune.TurnCntlFeed();
		this.tcfD1 = new ICP_MS.Plugin.Tune.TurnCntlFeed();
		this.tcfD2 = new ICP_MS.Plugin.Tune.TurnCntlFeed();
		this.tcfQuadPole = new ICP_MS.Plugin.Tune.TurnCntl();
		this.tcfprePole = new ICP_MS.Plugin.Tune.TurnCntl();
		this.chkLink = new System.Windows.Forms.CheckBox();
		this.flowLayoutPanel1.SuspendLayout();
		base.SuspendLayout();
		this.flowLayoutPanel1.AutoScroll = true;
		this.flowLayoutPanel1.Controls.Add(this.tcfX);
		this.flowLayoutPanel1.Controls.Add(this.tcfY);
		this.flowLayoutPanel1.Controls.Add(this.tcfZ);
		this.flowLayoutPanel1.Controls.Add(this.tcfNebuliser);
		this.flowLayoutPanel1.Controls.Add(this.tcfPower);
		this.flowLayoutPanel1.Controls.Add(this.tcfExtraction);
		this.flowLayoutPanel1.Controls.Add(this.tcfLens1);
		this.flowLayoutPanel1.Controls.Add(this.tcfLens2);
		this.flowLayoutPanel1.Controls.Add(this.tcfPoleBias);
		this.flowLayoutPanel1.Controls.Add(this.tcfLens3);
		this.flowLayoutPanel1.Controls.Add(this.tcfFocus);
		this.flowLayoutPanel1.Controls.Add(this.tcfD1);
		this.flowLayoutPanel1.Controls.Add(this.tcfD2);
		this.flowLayoutPanel1.Controls.Add(this.tcfQuadPole);
		this.flowLayoutPanel1.Controls.Add(this.tcfprePole);
		this.flowLayoutPanel1.Controls.Add(this.chkLink);
		this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
		this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
		this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(4);
		this.flowLayoutPanel1.Name = "flowLayoutPanel1";
		this.flowLayoutPanel1.Size = new System.Drawing.Size(347, 1055);
		this.flowLayoutPanel1.TabIndex = 39;
		this.tcfX.BackColor = System.Drawing.SystemColors.GradientInactiveCaption;
		this.tcfX.C = 0.0;
		this.tcfX.CodeId = 0u;
		this.tcfX.Coe = new decimal(new int[4] { 1, 0, 0, 0 });
		this.tcfX.DecimalPlaces = 2;
		this.tcfX.Defalut = 0.0;
		this.tcfX.DestId = 0u;
		this.tcfX.FeedDecimal = 2;
		this.tcfX.Increment = new decimal(new int[4] { 1, 0, 0, 65536 });
		this.tcfX.K = 0.0;
		this.tcfX.Label = "水平位置";
		this.tcfX.Location = new System.Drawing.Point(7, 6);
		this.tcfX.Margin = new System.Windows.Forms.Padding(7, 6, 7, 6);
		this.tcfX.MaxValue = new decimal(new int[4] { 21, 0, 0, 0 });
		this.tcfX.MinValue = new decimal(new int[4] { 1, 0, 0, 0 });
		this.tcfX.Name = "tcfX";
		this.tcfX.Size = new System.Drawing.Size(310, 68);
		this.tcfX.TabIndex = 38;
		this.tcfX.TipMax = double.NaN;
		this.tcfX.TipMin = double.NaN;
		this.tcfX.Value = new decimal(new int[4]);
		this.tcfY.BackColor = System.Drawing.SystemColors.GradientInactiveCaption;
		this.tcfY.C = 0.0;
		this.tcfY.CodeId = 0u;
		this.tcfY.Coe = new decimal(new int[4] { 1, 0, 0, 0 });
		this.tcfY.DecimalPlaces = 2;
		this.tcfY.Defalut = 0.0;
		this.tcfY.DestId = 0u;
		this.tcfY.FeedDecimal = 2;
		this.tcfY.Increment = new decimal(new int[4] { 1, 0, 0, 65536 });
		this.tcfY.K = 0.0;
		this.tcfY.Label = "垂直位置";
		this.tcfY.Location = new System.Drawing.Point(7, 86);
		this.tcfY.Margin = new System.Windows.Forms.Padding(7, 6, 7, 6);
		this.tcfY.MaxValue = new decimal(new int[4] { 21, 0, 0, 0 });
		this.tcfY.MinValue = new decimal(new int[4]);
		this.tcfY.Name = "tcfY";
		this.tcfY.Size = new System.Drawing.Size(310, 68);
		this.tcfY.TabIndex = 39;
		this.tcfY.TipMax = double.NaN;
		this.tcfY.TipMin = double.NaN;
		this.tcfY.Value = new decimal(new int[4]);
		this.tcfZ.BackColor = System.Drawing.SystemColors.GradientInactiveCaption;
		this.tcfZ.C = 0.0;
		this.tcfZ.CodeId = 0u;
		this.tcfZ.Coe = new decimal(new int[4] { 1, 0, 0, 0 });
		this.tcfZ.DecimalPlaces = 2;
		this.tcfZ.Defalut = 0.0;
		this.tcfZ.DestId = 0u;
		this.tcfZ.FeedDecimal = 2;
		this.tcfZ.Increment = new decimal(new int[4] { 1, 0, 0, 65536 });
		this.tcfZ.K = 0.0;
		this.tcfZ.Label = "采样深度";
		this.tcfZ.Location = new System.Drawing.Point(7, 166);
		this.tcfZ.Margin = new System.Windows.Forms.Padding(7, 6, 7, 6);
		this.tcfZ.MaxValue = new decimal(new int[4] { 21, 0, 0, 0 });
		this.tcfZ.MinValue = new decimal(new int[4]);
		this.tcfZ.Name = "tcfZ";
		this.tcfZ.Size = new System.Drawing.Size(310, 68);
		this.tcfZ.TabIndex = 36;
		this.tcfZ.TipMax = double.NaN;
		this.tcfZ.TipMin = double.NaN;
		this.tcfZ.Value = new decimal(new int[4]);
		this.tcfNebuliser.BackColor = System.Drawing.SystemColors.GradientInactiveCaption;
		this.tcfNebuliser.C = 0.0;
		this.tcfNebuliser.CodeId = 0u;
		this.tcfNebuliser.Coe = new decimal(new int[4] { 1, 0, 0, 0 });
		this.tcfNebuliser.DecimalPlaces = 2;
		this.tcfNebuliser.Defalut = 0.0;
		this.tcfNebuliser.DestId = 0u;
		this.tcfNebuliser.FeedDecimal = 2;
		this.tcfNebuliser.Increment = new decimal(new int[4] { 1, 0, 0, 131072 });
		this.tcfNebuliser.K = 0.0;
		this.tcfNebuliser.Label = "载气流量(L/min)";
		this.tcfNebuliser.Location = new System.Drawing.Point(7, 246);
		this.tcfNebuliser.Margin = new System.Windows.Forms.Padding(7, 6, 7, 6);
		this.tcfNebuliser.MaxValue = new decimal(new int[4] { 2, 0, 0, 0 });
		this.tcfNebuliser.MinValue = new decimal(new int[4]);
		this.tcfNebuliser.Name = "tcfNebuliser";
		this.tcfNebuliser.Size = new System.Drawing.Size(310, 68);
		this.tcfNebuliser.TabIndex = 35;
		this.tcfNebuliser.TipMax = double.NaN;
		this.tcfNebuliser.TipMin = double.NaN;
		this.tcfNebuliser.Value = new decimal(new int[4]);
		this.tcfPower.BackColor = System.Drawing.SystemColors.GradientInactiveCaption;
		this.tcfPower.C = 0.0;
		this.tcfPower.CodeId = 0u;
		this.tcfPower.Coe = new decimal(new int[4] { 1, 0, 0, 0 });
		this.tcfPower.DecimalPlaces = 1;
		this.tcfPower.Defalut = 0.0;
		this.tcfPower.DestId = 0u;
		this.tcfPower.FeedDecimal = 1;
		this.tcfPower.Increment = new decimal(new int[4] { 1, 0, 0, 0 });
		this.tcfPower.K = 0.0;
		this.tcfPower.Label = "功率(W)";
		this.tcfPower.Location = new System.Drawing.Point(7, 326);
		this.tcfPower.Margin = new System.Windows.Forms.Padding(7, 6, 7, 6);
		this.tcfPower.MaxValue = new decimal(new int[4] { 2000, 0, 0, 0 });
		this.tcfPower.MinValue = new decimal(new int[4] { 100, 0, 0, 0 });
		this.tcfPower.Name = "tcfPower";
		this.tcfPower.Size = new System.Drawing.Size(310, 68);
		this.tcfPower.TabIndex = 38;
		this.tcfPower.TipMax = double.NaN;
		this.tcfPower.TipMin = double.NaN;
		this.tcfPower.Value = new decimal(new int[4]);
		this.tcfExtraction.BackColor = System.Drawing.SystemColors.GradientInactiveCaption;
		this.tcfExtraction.C = 0.0;
		this.tcfExtraction.CodeId = 0u;
		this.tcfExtraction.Coe = new decimal(new int[4] { 1, 0, 0, 0 });
		this.tcfExtraction.DecimalPlaces = 2;
		this.tcfExtraction.Defalut = 0.0;
		this.tcfExtraction.DestId = 0u;
		this.tcfExtraction.FeedDecimal = 2;
		this.tcfExtraction.Increment = new decimal(new int[4] { 1, 0, 0, 0 });
		this.tcfExtraction.K = 0.0;
		this.tcfExtraction.Label = "Extraction";
		this.tcfExtraction.Location = new System.Drawing.Point(7, 406);
		this.tcfExtraction.Margin = new System.Windows.Forms.Padding(7, 6, 7, 6);
		this.tcfExtraction.MaxValue = new decimal(new int[4]);
		this.tcfExtraction.MinValue = new decimal(new int[4] { 1100, 0, 0, -2147483648 });
		this.tcfExtraction.Name = "tcfExtraction";
		this.tcfExtraction.Size = new System.Drawing.Size(310, 68);
		this.tcfExtraction.TabIndex = 25;
		this.tcfExtraction.TipMax = double.NaN;
		this.tcfExtraction.TipMin = double.NaN;
		this.tcfExtraction.Value = new decimal(new int[4]);
		this.tcfLens1.BackColor = System.Drawing.SystemColors.GradientInactiveCaption;
		this.tcfLens1.C = 0.0;
		this.tcfLens1.CodeId = 0u;
		this.tcfLens1.Coe = new decimal(new int[4] { 1, 0, 0, 0 });
		this.tcfLens1.DecimalPlaces = 0;
		this.tcfLens1.Defalut = 0.0;
		this.tcfLens1.DestId = 0u;
		this.tcfLens1.FeedDecimal = 2;
		this.tcfLens1.Increment = new decimal(new int[4] { 1, 0, 0, 0 });
		this.tcfLens1.K = 0.0;
		this.tcfLens1.Label = "Lens 1";
		this.tcfLens1.Location = new System.Drawing.Point(7, 486);
		this.tcfLens1.Margin = new System.Windows.Forms.Padding(7, 6, 7, 6);
		this.tcfLens1.MaxValue = new decimal(new int[4]);
		this.tcfLens1.MinValue = new decimal(new int[4] { 2000, 0, 0, -2147483648 });
		this.tcfLens1.Name = "tcfLens1";
		this.tcfLens1.Size = new System.Drawing.Size(310, 68);
		this.tcfLens1.TabIndex = 34;
		this.tcfLens1.TipMax = double.NaN;
		this.tcfLens1.TipMin = double.NaN;
		this.tcfLens1.Value = new decimal(new int[4]);
		this.tcfLens2.BackColor = System.Drawing.SystemColors.GradientInactiveCaption;
		this.tcfLens2.C = 0.0;
		this.tcfLens2.CodeId = 0u;
		this.tcfLens2.Coe = new decimal(new int[4] { 1, 0, 0, 0 });
		this.tcfLens2.DecimalPlaces = 2;
		this.tcfLens2.Defalut = 0.0;
		this.tcfLens2.DestId = 0u;
		this.tcfLens2.FeedDecimal = 2;
		this.tcfLens2.Increment = new decimal(new int[4] { 1, 0, 0, 0 });
		this.tcfLens2.K = 0.0;
		this.tcfLens2.Label = "Lens 2";
		this.tcfLens2.Location = new System.Drawing.Point(7, 566);
		this.tcfLens2.Margin = new System.Windows.Forms.Padding(7, 6, 7, 6);
		this.tcfLens2.MaxValue = new decimal(new int[4]);
		this.tcfLens2.MinValue = new decimal(new int[4] { 200, 0, 0, -2147483648 });
		this.tcfLens2.Name = "tcfLens2";
		this.tcfLens2.Size = new System.Drawing.Size(310, 68);
		this.tcfLens2.TabIndex = 33;
		this.tcfLens2.TipMax = double.NaN;
		this.tcfLens2.TipMin = double.NaN;
		this.tcfLens2.Value = new decimal(new int[4]);
		this.tcfPoleBias.BackColor = System.Drawing.SystemColors.GradientInactiveCaption;
		this.tcfPoleBias.C = 0.0;
		this.tcfPoleBias.CodeId = 0u;
		this.tcfPoleBias.Coe = new decimal(new int[4] { 1, 0, 0, 0 });
		this.tcfPoleBias.DecimalPlaces = 2;
		this.tcfPoleBias.Defalut = 0.0;
		this.tcfPoleBias.DestId = 0u;
		this.tcfPoleBias.FeedDecimal = 2;
		this.tcfPoleBias.Increment = new decimal(new int[4] { 1, 0, 0, 0 });
		this.tcfPoleBias.K = 0.0;
		this.tcfPoleBias.Label = "Hex Polebias";
		this.tcfPoleBias.Location = new System.Drawing.Point(7, 646);
		this.tcfPoleBias.Margin = new System.Windows.Forms.Padding(7, 6, 7, 6);
		this.tcfPoleBias.MaxValue = new decimal(new int[4]);
		this.tcfPoleBias.MinValue = new decimal(new int[4] { 30, 0, 0, -2147483648 });
		this.tcfPoleBias.Name = "tcfPoleBias";
		this.tcfPoleBias.Size = new System.Drawing.Size(310, 68);
		this.tcfPoleBias.TabIndex = 27;
		this.tcfPoleBias.TipMax = double.NaN;
		this.tcfPoleBias.TipMin = double.NaN;
		this.tcfPoleBias.Value = new decimal(new int[4]);
		this.tcfLens3.BackColor = System.Drawing.SystemColors.GradientInactiveCaption;
		this.tcfLens3.C = 0.0;
		this.tcfLens3.CodeId = 0u;
		this.tcfLens3.Coe = new decimal(new int[4] { 1, 0, 0, 0 });
		this.tcfLens3.DecimalPlaces = 2;
		this.tcfLens3.Defalut = 0.0;
		this.tcfLens3.DestId = 0u;
		this.tcfLens3.FeedDecimal = 2;
		this.tcfLens3.Increment = new decimal(new int[4] { 1, 0, 0, 0 });
		this.tcfLens3.K = 0.0;
		this.tcfLens3.Label = "Lens 3";
		this.tcfLens3.Location = new System.Drawing.Point(7, 726);
		this.tcfLens3.Margin = new System.Windows.Forms.Padding(7, 6, 7, 6);
		this.tcfLens3.MaxValue = new decimal(new int[4]);
		this.tcfLens3.MinValue = new decimal(new int[4] { 200, 0, 0, -2147483648 });
		this.tcfLens3.Name = "tcfLens3";
		this.tcfLens3.Size = new System.Drawing.Size(310, 68);
		this.tcfLens3.TabIndex = 32;
		this.tcfLens3.TipMax = double.NaN;
		this.tcfLens3.TipMin = double.NaN;
		this.tcfLens3.Value = new decimal(new int[4]);
		this.tcfFocus.BackColor = System.Drawing.SystemColors.GradientInactiveCaption;
		this.tcfFocus.C = 0.0;
		this.tcfFocus.CodeId = 0u;
		this.tcfFocus.Coe = new decimal(new int[4] { 1, 0, 0, 0 });
		this.tcfFocus.DecimalPlaces = 2;
		this.tcfFocus.Defalut = 0.0;
		this.tcfFocus.DestId = 0u;
		this.tcfFocus.FeedDecimal = 2;
		this.tcfFocus.Increment = new decimal(new int[4] { 5, 0, 0, 65536 });
		this.tcfFocus.K = 0.0;
		this.tcfFocus.Label = "Focus";
		this.tcfFocus.Location = new System.Drawing.Point(7, 806);
		this.tcfFocus.Margin = new System.Windows.Forms.Padding(7, 6, 7, 6);
		this.tcfFocus.MaxValue = new decimal(new int[4] { 50, 0, 0, 0 });
		this.tcfFocus.MinValue = new decimal(new int[4]);
		this.tcfFocus.Name = "tcfFocus";
		this.tcfFocus.Size = new System.Drawing.Size(310, 68);
		this.tcfFocus.TabIndex = 31;
		this.tcfFocus.TipMax = double.NaN;
		this.tcfFocus.TipMin = double.NaN;
		this.tcfFocus.Value = new decimal(new int[4]);
		this.tcfD1.BackColor = System.Drawing.SystemColors.GradientInactiveCaption;
		this.tcfD1.C = 0.0;
		this.tcfD1.CodeId = 0u;
		this.tcfD1.Coe = new decimal(new int[4] { 1, 0, 0, 0 });
		this.tcfD1.DecimalPlaces = 2;
		this.tcfD1.Defalut = 0.0;
		this.tcfD1.DestId = 0u;
		this.tcfD1.FeedDecimal = 2;
		this.tcfD1.Increment = new decimal(new int[4] { 1, 0, 0, 0 });
		this.tcfD1.K = 0.0;
		this.tcfD1.Label = "D1";
		this.tcfD1.Location = new System.Drawing.Point(7, 886);
		this.tcfD1.Margin = new System.Windows.Forms.Padding(7, 6, 7, 6);
		this.tcfD1.MaxValue = new decimal(new int[4]);
		this.tcfD1.MinValue = new decimal(new int[4] { 200, 0, 0, -2147483648 });
		this.tcfD1.Name = "tcfD1";
		this.tcfD1.Size = new System.Drawing.Size(310, 68);
		this.tcfD1.TabIndex = 28;
		this.tcfD1.TipMax = double.NaN;
		this.tcfD1.TipMin = double.NaN;
		this.tcfD1.Value = new decimal(new int[4]);
		this.tcfD2.BackColor = System.Drawing.SystemColors.GradientInactiveCaption;
		this.tcfD2.C = 0.0;
		this.tcfD2.CodeId = 0u;
		this.tcfD2.Coe = new decimal(new int[4] { 1, 0, 0, 0 });
		this.tcfD2.DecimalPlaces = 2;
		this.tcfD2.Defalut = 0.0;
		this.tcfD2.DestId = 0u;
		this.tcfD2.FeedDecimal = 2;
		this.tcfD2.Increment = new decimal(new int[4] { 1, 0, 0, 0 });
		this.tcfD2.K = 0.0;
		this.tcfD2.Label = "D2";
		this.tcfD2.Location = new System.Drawing.Point(7, 966);
		this.tcfD2.Margin = new System.Windows.Forms.Padding(7, 6, 7, 6);
		this.tcfD2.MaxValue = new decimal(new int[4]);
		this.tcfD2.MinValue = new decimal(new int[4] { 200, 0, 0, -2147483648 });
		this.tcfD2.Name = "tcfD2";
		this.tcfD2.Size = new System.Drawing.Size(310, 68);
		this.tcfD2.TabIndex = 26;
		this.tcfD2.TipMax = double.NaN;
		this.tcfD2.TipMin = double.NaN;
		this.tcfD2.Value = new decimal(new int[4]);
		this.tcfQuadPole.BackColor = System.Drawing.SystemColors.GradientInactiveCaption;
		this.tcfQuadPole.C = 2043.11;
		this.tcfQuadPole.CodeId = 1u;
		this.tcfQuadPole.Coe = new decimal(new int[4] { 1, 0, 0, 0 });
		this.tcfQuadPole.DecimalPlaces = 2;
		this.tcfQuadPole.Defalut = 0.0;
		this.tcfQuadPole.DestId = 16u;
		this.tcfQuadPole.FeedDecimal = 1;
		this.tcfQuadPole.Increment = new decimal(new int[4] { 1, 0, 0, 65536 });
		this.tcfQuadPole.K = 205.37;
		this.tcfQuadPole.Label = "四极杆偏置";
		this.tcfQuadPole.Location = new System.Drawing.Point(7, 1046);
		this.tcfQuadPole.Margin = new System.Windows.Forms.Padding(7, 6, 7, 6);
		this.tcfQuadPole.MaxValue = new decimal(new int[4] { 15, 0, 0, 0 });
		this.tcfQuadPole.MinValue = new decimal(new int[4] { 15, 0, 0, -2147483648 });
		this.tcfQuadPole.Name = "tcfQuadPole";
		this.tcfQuadPole.Size = new System.Drawing.Size(310, 66);
		this.tcfQuadPole.TabIndex = 51;
		this.tcfQuadPole.TipMax = double.NaN;
		this.tcfQuadPole.TipMin = double.NaN;
		this.tcfQuadPole.Value = new decimal(new int[4]);
		this.tcfprePole.BackColor = System.Drawing.SystemColors.GradientInactiveCaption;
		this.tcfprePole.C = 2043.11;
		this.tcfprePole.CodeId = 1u;
		this.tcfprePole.Coe = new decimal(new int[4] { 1, 0, 0, 0 });
		this.tcfprePole.DecimalPlaces = 2;
		this.tcfprePole.Defalut = 0.0;
		this.tcfprePole.DestId = 16u;
		this.tcfprePole.FeedDecimal = 1;
		this.tcfprePole.Increment = new decimal(new int[4] { 1, 0, 0, 65536 });
		this.tcfprePole.K = 205.37;
		this.tcfprePole.Label = "预杆偏置";
		this.tcfprePole.Location = new System.Drawing.Point(7, 1124);
		this.tcfprePole.Margin = new System.Windows.Forms.Padding(7, 6, 7, 6);
		this.tcfprePole.MaxValue = new decimal(new int[4] { 15, 0, 0, 0 });
		this.tcfprePole.MinValue = new decimal(new int[4] { 15, 0, 0, -2147483648 });
		this.tcfprePole.Name = "tcfprePole";
		this.tcfprePole.Size = new System.Drawing.Size(310, 66);
		this.tcfprePole.TabIndex = 52;
		this.tcfprePole.TipMax = double.NaN;
		this.tcfprePole.TipMin = double.NaN;
		this.tcfprePole.Value = new decimal(new int[4]);
		this.chkLink.AutoSize = true;
		this.chkLink.Location = new System.Drawing.Point(3, 1199);
		this.chkLink.Name = "chkLink";
		this.chkLink.Size = new System.Drawing.Size(224, 19);
		this.chkLink.TabIndex = 53;
		this.chkLink.Text = "四极杆偏置和六极杆偏置联动";
		this.chkLink.UseVisualStyleBackColor = true;
		this.chkLink.CheckedChanged += new System.EventHandler(chkLink_CheckedChanged);
		base.AutoScaleDimensions = new System.Drawing.SizeF(8f, 15f);
		base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
		base.ClientSize = new System.Drawing.Size(347, 1055);
		base.Controls.Add(this.flowLayoutPanel1);
		base.Margin = new System.Windows.Forms.Padding(5);
		base.Name = "FormMajor";
		base.ShowIcon = false;
		this.Text = "Major";
		base.FormClosing += new System.Windows.Forms.FormClosingEventHandler(FormLens_FormClosing);
		base.Load += new System.EventHandler(FormLens_Load);
		this.flowLayoutPanel1.ResumeLayout(false);
		this.flowLayoutPanel1.PerformLayout();
		base.ResumeLayout(false);
	}
}
